<%@page import="modulo1.cdp.Matricula"%>
<%@page import="modulo1.cgt.ControleTurmaMatriculaApl"%>
<%@page import="modulo1.cdp.Aluno"%>
<%@page import="modulo1.cdp.Turma"%>
<%@page import="java.util.List"%>
<div class="table" style="border-top:2px solid #f70;">
    <%
        if (request.getParameter("mensagem") != null) {
            out.print("<script>alert(\"" + request.getParameter("mensagem") + "\")</script>");
        }
    %>
    <br />
    <form method="post" id="evento">
        <input type="hidden" name="evento" value="inserir" />
        <a class="button" style="cursor: pointer;" id="btnSalvar">Salvar</a>
        <a class="button" style="cursor: pointer;" href="Nota">Voltar</a>
        <br />
        <table class="listing form" cellpadding="0" cellspacing="0">            
            <tr>
                <th class="first" width="70%">Nome</th>
                <th>Nota</th>                
            </tr>
            <%
                int bg = 1;
                List<Matricula> matriculas = (List<Matricula>) request.getAttribute("matriculas");
                Turma turma = (Turma) request.getAttribute("turma");
                boolean flag = false;
                for (int i = 0; i < matriculas.size(); i++) {
            %>
            <tr <%=(bg == 1) ? "class=\"bg\"" : ""%>>
                <td class="first style1"><%=matriculas.get(i).getAluno().getNome()%></td>                
                <td><input type="text" name="nota_<%=matriculas.get(i).getId()%>" value="<%=matriculas.get(i).getNotaFinal() == null ? "" : matriculas.get(i).getNotaFinal()%>"></td>
            </tr>
            <% }%>         
        </table>
        <p>&nbsp;</p>  
        <input type="hidden" id="turma" name="turma" value="<%=turma.getId()%>" />
    </form>
</div>      
<script>
    $('#btnSalvar').click(function(){
        $('#evento').submit();
    });
</script>
